<template>
	<view class='load-more' :class="[{'show-loading':loading}]">
		<block v-if="!loading&&noMore">
			<view class="loadmore-line"></view>
			<text class="loadmore-text">{{noMoreText}}</text>
			<view class="loadmore-line"></view>
		</block>
		<block v-if="loading">
			<view class="loading-box flex-center flex-column radius-16" :style="{background:pageColor}">
				<view class="loading-animation"></view>
			</view>
		</block>
	</view>
</template>

<script>
	import {
		mapState,
		mapActions,
		mapMutations
	} from "vuex"
	export default {
		name: 'load-more',
		props: {
			loadText: {
				type: String,
				default () {
					return '努力加载中'
				}
			},
			noMoreText: {
				type: String,
				default () {
					return '没有更多了'
				}
			},
			noMore: {
				type: Boolean,
				default () {
					return false
				}
			},
			loading: {
				type: Boolean,
				default () {
					return true
				}
			}
		},
		created() {

		},
		data() {
			return {

			}
		},
		computed: mapState({
			configInfo: state => state.config.configInfo,
			isShowLogin: state => state.user.isShowLogin
		}),
		methods: {

		},
	}
</script>

<style lang="scss">
	.load-more {
		display: flex;
		width: 100%;
		height: 90rpx;
		font-size: 28rpx;
		justify-content: center;
		align-items: center;
		z-index: 9;

		.loadmore-text {
			color: #999;
		}

		.loadmore-line {
			width: 100rpx;
			height: 1rpx;
			border-top: 1rpx solid #d2d2d2;
		}


		.loading-box {
			width: 200rpx;
			height: 200rpx;
			margin-top: 70%;

			/* 加载中动画 */
			.loading-animation {
				width: 250rpx;
				height: 250rpx;
				// width: 300rpx;
				// height: 300rpx;
				display: inline-block;
				vertical-align: middle;
				background: transparent url() no-repeat;
				background-size: 100%;
				margin-top: -25rpx;
			}
		}

	}

	.show-loading {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		height: 100vh;
	}


	@-webkit-keyframes a {
		0% {
			-webkit-transform: rotate(0deg);
			transform: rotate(0deg)
		}

		to {
			-webkit-transform: rotate(1turn);
			transform: rotate(1turn)
		}
	}

	@keyframes a {
		0% {
			-webkit-transform: rotate(0deg);
			transform: rotate(0deg)
		}

		to {
			-webkit-transform: rotate(1turn);
			transform: rotate(1turn)
		}
	}
</style>